/*
 * @Descripttion:
 * @Author: kcz
 * @Date: 2021-05-02 16:04:02
 * @LastEditors: kcz
 * @LastEditTime: 2022-10-26 23:28:19
 */
import Vue from "vue";
import App from "./App.vue";
import router from "./router/";
import store from "./store";
// import "./assets/css/className.less"
import Cmp from "./components/CustomComponent/index.vue";
import Head from "./components/CustomComponent/head.vue";
import LoginItem from "./components/CustomComponent/loginItem.vue";
import EchartPie from "./components/CustomComponent/echartPie.vue";

// 预加载组件
// import "../packages/core/preUseComponents";
// 懒加载组件
import { useAntd } from "../packages/core/useComponents";
import { nodeSchema } from "../packages/mini";
import KFormDesign from "../packages/use";

// const Cmp = {
//   label: "cmp",
//   render: function(h) {
//     return h("div", "我是自定义组件");
//   }
// };

// 添加字段
nodeSchema.addSchemas([
  {
    type: "demo", // 表单类型
    label: "自定义组件", // 标题文字
    icon: "icon-gallery",
    component: Cmp,
    options: {
      defaultValue: undefined,
      multiple: false,
      disabled: false,
      width: "100%",
      clearable: true,
      placeholder: "请选择",
      showSearch: false,
      showLabel: false
    },
    model: "",
    key: "",
    rules: [
      {
        required: false,
        message: "必填项"
      }
    ]
  },
  {
    type: "pie",
    label: "饼图",
    icon: "icon-gallery",
    component: EchartPie,
    options: {
      defaultValue: undefined,
      multiple: false,
      disabled: false,
      width: "100%",
      clearable: true,
      // placeholder: "请选择",
      showSearch: false,
      showLabel: false
    },
    model: "",
    key: "",
    rules: [
      {
        required: false,
        message: "必填项"
      }
    ]
  },
  {
    type: "head",
    label: "标题",
    icon: "icon-gallery",
    component: Head,
    className: {
      fontSize: '',
      title: '头部标题',
      color: '',
      borderWidth: '',
      borderWidthTop: '',
      borderWidthRight: '',
      borderWidthBottom: '',
      borderWidthLeft: '',
      borderStyle: '',
      borderColor: '',
      borderRadius: '',
      borderColorTop: '',
      borderColorRight: '',
      borderColorBottom: '',
      borderColorLeft: '',
      backGroundColor: '',
      display: 'flex',
      justifyContent: 'justify-between',
      alignContent: '',
      justifyItems: '',
      alignItems: 'items-center',
      margin: '',
      marginTop: '',
      marginRight: '',
      marginBottom: '',
      marginLeft: '',
      padding: '',
      paddingTop: '',
      paddingRight: '',
      paddingBottom: '',
      paddingLeft: '',
      spaceX: '',
      spaceY: '',
      wrap: '',
      shadow: '',
      shadowColor: '',
      headExtra: false,
    },
    options: {
      defaultValue: undefined,
      multiple: false,
      disabled: false,
      width: "100%",
      clearable: true,
      // placeholder: "请选择",
      showSearch: false,
      showLabel: false,
      noFormItem: true,
    },
    model: "",
    key: "",
    rules: [
      {
        required: false,
        message: "必填项"
      }
    ]
  },
  {
    type: "loginItem",
    label: "登录项",
    icon: "icon-gallery",
    component: LoginItem,
    className: {
      type: 'text',
      placeholder: '请输入用户名',
      icon: 'user',
      margin: '',
      marginTop: '',
      marginRight: '',
      marginBottom: 'mb-5',
      marginLeft: '',
      padding: 'p-2',
      paddingTop: '',
      paddingRight: '',
      paddingBottom: '',
      paddingLeft: '',
      borderWidth: 'border',
      borderStyle: 'border-solid',
      borderColor: 'border-gray-300',
      borderRadius: 'rounded',
      backGroundColor: '',
    },
    options: {
      defaultValue: undefined,
      multiple: false,
      disabled: false,
      // width: "100%",
      clearable: true,
      // placeholder: "请选择",
      showSearch: false,
      showLabel: false,
      noFormItem: true,
    },
    model: "",
    key: "",
    rules: [
      {
        required: false,
        message: "必填项"
      }
    ]
  },
]);

// 添加分组
nodeSchema.addSchemaGroup({
  title: "自定义组件",
  list: ["demo", 'pie', 'head', 'loginItem', 'tree', 'list']
});

// nodeSchema.addSchemaGroup({
//   title: "登录页模板",
//   list: ["login1"]
// });

/*右键菜单*/
import contentmenu from 'v-contextmenu'
import 'v-contextmenu/dist/index.css'
Vue.use(contentmenu)

import layer from 'rx-vue-layer'
import 'rx-vue-layer/lib/vue-layer.css';
Vue.prototype.$layer = layer(Vue);

Vue.use(KFormDesign);
useAntd(Vue);
// KFormDesign.setFormBuildConfig({
//   dynamicData: {
//     test: [
//       { label: "test", value: "1" },
//       { label: "test1", value: "2" }
//     ]
//   }
// });
Vue.config.productionTip = false;

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount("#app");
